#! /bin/sh

set -e
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

url=$1
dd=$(date +%F)
dataDir=/home/david/wda/test004/data/$dd
dataFile=$dataDir/0001
if [ ! -d $dataDir ]; then
	mkdir $dataDir
fi
tt=$(date +%s)

if [ $url"x" != "x" ]; then
	curl  -L -e  '; auto' -r "0-192" -o /dev/null -s -w "%{http_code}:%{num_connects}:%{num_redirects}:%{time_redirect}:%{time_namelookup}:%{time_connect}:%{time_pretransfer}:%{time_starttransfer}:%{time_total}:%{speed_download}" $url >> $dataFile
	echo ":$tt" >> $dataFile
fi

exit 0
